home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 April: Mac OS SDK / Dev.CD Apr 97 SDK1.toast / Development Kits (Disc 1) / Interfaces&Libraries / Interfaces / PInterfaces / Aliases.p < prev    next >
Encoding:
Text File  |  1995-07-06  |  5.6 KB  |  166 lines  |  [TEXT/MPS ]

  1. {
  2.      File:        Aliases.p
  3.  
  4.      Contains:    Alias Manager Interfaces.
  5.  
  6.      Version:    Technology:    System 7.5
  7.                  Package:    Universal Interfaces 2.1 in “MPW Latest” on ETO #18
  8.  
  9.      Copyright:    © 1984-1995 by Apple Computer, Inc.
  10.                  All rights reserved.
  11.  
  12.      Bugs?:        If you find a problem with this file, use the Apple Bug Reporter
  13.                  stack.  Include the file and version information (from above)
  14.                  in the problem description and send to:
  15.                      Internet:    apple.bugs@applelink.apple.com
  16.                      AppleLink:    APPLE.BUGS
  17.  
  18. }
  19.  
  20. {$IFC UNDEFINED UsingIncludes}
  21. {$SETC UsingIncludes := 0}
  22. {$ENDC}
  23.  
  24. {$IFC NOT UsingIncludes}
  25.  UNIT Aliases;
  26.  INTERFACE
  27. {$ENDC}
  28.  
  29. {$IFC UNDEFINED __ALIASES__}
  30. {$SETC __ALIASES__ := 1}
  31.  
  32. {$I+}
  33. {$SETC AliasesIncludes := UsingIncludes}
  34. {$SETC UsingIncludes := 1}
  35.  
  36.  
  37. {$IFC UNDEFINED __TYPES__}
  38. {$I Types.p}
  39. {$ENDC}
  40. {    ConditionalMacros.p                                            }
  41.  
  42. {$IFC UNDEFINED __APPLETALK__}
  43. {$I AppleTalk.p}
  44. {$ENDC}
  45. {    OSUtils.p                                                    }
  46. {        MixedMode.p                                                }
  47. {        Memory.p                                                }
  48.  
  49. {$IFC UNDEFINED __FILES__}
  50. {$I Files.p}
  51. {$ENDC}
  52. {    Finder.p                                                    }
  53.  
  54. {$PUSH}
  55. {$ALIGN MAC68K}
  56. {$LibExport+}
  57.  
  58. CONST
  59.     rAliasType                    = 'alis';                        { Aliases are stored as resources of this type }
  60. { define alias resolution action rules mask }
  61.     kARMMountVol                = $00000001;                    { mount the volume automatically }
  62.     kARMNoUI                    = $00000002;                    { no user interface allowed during resolution }
  63.     kARMMultVols                = $00000008;                    { search on multiple volumes }
  64.     kARMSearch                    = $00000100;                    { search quickly }
  65.     kARMSearchMore                = $00000200;                    { search further }
  66.     kARMSearchRelFirst            = $00000400;                    { search target on a relative path first }
  67. { define alias record information types }
  68.     asiZoneName                    = -3;                            { get zone name }
  69.     asiServerName                = -2;                            { get server name }
  70.     asiVolumeName                = -1;                            { get volume name }
  71.     asiAliasName                = 0;                            { get aliased file/folder/volume name }
  72.     asiParentName                = 1;                            { get parent folder name }
  73.  
  74. { define the alias record that will be the blackbox for the caller }
  75.  
  76. TYPE
  77.     AliasRecord = RECORD
  78.         userType:                OSType;                                    { appl stored type like creator type }
  79.         aliasSize:                INTEGER;                                { alias record size in bytes, for appl usage }
  80.     END;
  81.  
  82.     AliasPtr = ^AliasRecord;
  83.     AliasHandle = ^AliasPtr;
  84.  
  85. { alias record information type }
  86.     AliasInfoType = INTEGER;
  87.  
  88.     AliasFilterProcPtr = ProcPtr;  { FUNCTION AliasFilter(cpbPtr: CInfoPBPtr; VAR quitFlag: BOOLEAN; myDataPtr: Ptr): BOOLEAN; }
  89.     AliasFilterUPP = UniversalProcPtr;
  90.  
  91. CONST
  92.     uppAliasFilterProcInfo = $00000FD0; { FUNCTION (4 byte param, 4 byte param, 4 byte param): 1 byte result; }
  93.  
  94. FUNCTION NewAliasFilterProc(userRoutine: AliasFilterProcPtr): AliasFilterUPP;
  95.     {$IFC NOT GENERATINGCFM }
  96.     INLINE $2E9F;
  97.     {$ENDC}
  98.  
  99. FUNCTION CallAliasFilterProc(cpbPtr: CInfoPBPtr; VAR quitFlag: BOOLEAN; myDataPtr: Ptr; userRoutine: AliasFilterUPP): BOOLEAN;
  100.     {$IFC NOT GENERATINGCFM}
  101.     INLINE $205F, $4E90;
  102.     {$ENDC}
  103.  
  104. FUNCTION NewAlias(fromFile: ConstFSSpecPtr; {CONST}VAR target: FSSpec; VAR alias: AliasHandle): OSErr;
  105.     {$IFC NOT GENERATINGCFM}
  106.     INLINE $7002, $A823;
  107.     {$ENDC}
  108. { create a minimal new alias for a target and return alias record handle }
  109. FUNCTION NewAliasMinimal({CONST}VAR target: FSSpec; VAR alias: AliasHandle): OSErr;
  110.     {$IFC NOT GENERATINGCFM}
  111.     INLINE $7008, $A823;
  112.     {$ENDC}
  113. { create a minimal new alias from a target fullpath (optional zone and server name) and return alias record handle  }
  114. FUNCTION NewAliasMinimalFromFullPath(fullPathLength: INTEGER; fullPath: UNIV Ptr; zoneName: ConstStr32Param; serverName: ConstStr31Param; VAR alias: AliasHandle): OSErr;
  115.     {$IFC NOT GENERATINGCFM}
  116.     INLINE $7009, $A823;
  117.     {$ENDC}
  118. { given an alias handle and fromFile, resolve the alias, update the alias record and return aliased filename and wasChanged flag. }
  119. FUNCTION ResolveAlias(fromFile: ConstFSSpecPtr; alias: AliasHandle; VAR target: FSSpec; VAR wasChanged: BOOLEAN): OSErr;
  120.     {$IFC NOT GENERATINGCFM}
  121.     INLINE $7003, $A823;
  122.     {$ENDC}
  123. { given an alias handle and an index specifying requested alias information type, return the information from alias record as a string. }
  124. FUNCTION GetAliasInfo(alias: AliasHandle; index: AliasInfoType; VAR theString: Str63): OSErr;
  125.     {$IFC NOT GENERATINGCFM}
  126.     INLINE $7007, $A823;
  127.     {$ENDC}
  128.   Given a file spec, return target file spec if input file spec is an alias.
  129.   It resolves the entire alias chain or one step of the chain.  It returns
  130.   info about whether the target is a folder or file; and whether the input
  131.   file spec was an alias or not. 
  132. }
  133. FUNCTION ResolveAliasFile(VAR theSpec: FSSpec; resolveAliasChains: BOOLEAN; VAR targetIsFolder: BOOLEAN; VAR wasAliased: BOOLEAN): OSErr;
  134.     {$IFC NOT GENERATINGCFM}
  135.     INLINE $700C, $A823;
  136.     {$ENDC}
  137. FUNCTION FollowFinderAlias(fromFile: ConstFSSpecPtr; alias: AliasHandle; logon: BOOLEAN; VAR target: FSSpec; VAR wasChanged: BOOLEAN): OSErr;
  138.     {$IFC NOT GENERATINGCFM}
  139.     INLINE $700F, $A823;
  140.     {$ENDC}
  141.    Low Level Routines 
  142.  Given an alias handle and fromFile, match the alias and return aliased filename(s) and needsUpdate flag
  143. }
  144. FUNCTION MatchAlias(fromFile: ConstFSSpecPtr; rulesMask: LONGINT; alias: AliasHandle; VAR aliasCount: INTEGER; aliasList: FSSpecArrayPtr; VAR needsUpdate: BOOLEAN; aliasFilter: AliasFilterUPP; yourDataPtr: UNIV Ptr): OSErr;
  145.     {$IFC NOT GENERATINGCFM}
  146.     INLINE $7005, $A823;
  147.     {$ENDC}
  148. { given a fromFile-target pair and an alias handle, update the lias record pointed to by alias handle to represent target as the new alias. }
  149. FUNCTION UpdateAlias(fromFile: ConstFSSpecPtr; {CONST}VAR target: FSSpec; alias: AliasHandle; VAR wasChanged: BOOLEAN): OSErr;
  150.     {$IFC NOT GENERATINGCFM}
  151.     INLINE $7006, $A823;
  152.     {$ENDC}
  153.  
  154. {$ALIGN RESET}
  155. {$POP}
  156.  
  157. {$SETC UsingIncludes := AliasesIncludes}
  158.  
  159. {$ENDC} {__ALIASES__}
  160.  
  161. {$IFC NOT UsingIncludes}
  162.  END.
  163. {$ENDC}
  164.